{{$logined:=.logined}}
<div class="body-wrapper">
	<div class="container">
		<div class="panel panel-primary">
			<!-- Default panel contents -->
			<div class="panel-heading">
				文章们都住这里´･ω･`
			{{if .logined}}
				<span class="glyphicon glyphicon-plus" style="float:right;color:#FFF;" data-toggle="modal" data-target="#add_article"></span>
				{{end}}
			</div>
			<div class="panel-body">
				<p>天行健君子以自强不息</p>
			</div>
			<!-- List group -->
			{{range .Articles}}
			<a class="list-group-item" href="/article/{{.Id}}">

				<h4 class="list-group-item-heading">
					{{.Name}} -- {{date .CreateTime "Y-m-d"}}
					{{if $logined}}
					<span style="float:right;" data-toggle="modal" data-target="#delete_article" class="glyphicon glyphicon-remove" onclick="(function(){$('#delete_article form').attr('action','/article/{{.Id}}/del');$('#delete_article .modal-header h4').html('你确定要删除{{.Name}}吗？')})()"></span>
					<span style="float:right;margin-right:3px" data-toggle="modal" data-target="#edit_article" class="glyphicon glyphicon-edit" onclick="(function(){$('#edit_article form').attr('action','/article/{{.Id}}/del');$('#edit_article form input[name=title]').attr('value','{{.Name}}');$('#edit_article form textarea').html('{{.Content}}');$('#edit_article form input[name=tags]').attr('value','{{range .Tags}}{{.}} {{end}}');$('#edit_article form input[name=categories]').attr('value','{{range .Categories}}{{.}} {{end}}');})()"></span>
					{{end}}
				</h4>
				<p class="list-group-item-text">
					{{if .Tags}}
					<h7>标签:</h7>
					{{range .Tags}}
					<span class="badge">{{.}}</span>
					{{end}}
							{{end}}

							{{if .Categories}}
					<h7>
						分类:
						{{range .Categories}}
						<span class="label label-default">{{.}}</span>
						{{end}}
					</h7>
					{{end}}
				</p>
			</a>
			{{end}}
		</div>
	</div>
</div>